#ifndef __Acceptor_H__
#define __Acceptor_H__
#include "InetAddress.h"
#include "Socket.h"

namespace wd
{

class Acceptor
{
public:
    Acceptor(unsigned short port, const string & ip = "127.0.0.1");

    void ready();
    int accept();
    int fd() const {    return _sock.fd();  }

private:
    void setReuseAddr(bool);
    void setReusePort(bool);
    void bind();
    void listen();

private:
    InetAddress _addr;
    Socket _sock;
};

}//end of namespace wd


#endif

